<script type="text/javascript">
	$(document).ready(function(){
		$('#show').hide();
		$('#kunjungan').change(function(){
			if(this.checked)
				$('#show').hide('slow');
			else
				$('#show').show('slow');

		});
	});
</script>
<?php 
	$data = $_GET['id'];
	$jenis = $_GET['jenis'];
	include ('../../../config/koneksi.php'); 
	include ('../../../config/library.php');
	include ('../../../config/fungsi_tgl_indo.php');
	$tgl = date("Y-m-d");
	$query = "select p.id_penduduk,id_peserta,nama,tempat_lahir,tgl_lahir,ayah,ibu,masa_berlaku,bpjs,pbi,jkn,is_miskin from penduduk p inner join peserta ps on p.id_penduduk = ps.id_penduduk inner join pekerjaan pk on p.id_pekerjaan = pk.id_pekerjaan inner join keluarga k on p.id_kk = k.id_kk where masa_berlaku >= '$tgl' and $jenis like '%$_GET[id]%'";
	//echo $query;
	$qry = mysql_query($query);
	$ketemu=mysql_num_rows($qry);
	
	$now = date("Y-m-d");

	if($ketemu >= 1) {
?>
		<table class="tabel">
			<tr>
				<th>NO</th>
				<th>ID Peserta</th>
				<th>Nama</th>
				<th>Tempat, Tanggal Lahir</th>
				<th>Ayah</th>
				<th>Ibu</th>
				<th>Masa Berlaku</th>
				<th>Aksi</th>
			</tr>
		<?php
			while($hasil=mysql_fetch_array($qry)){
				$no++;
		?>
				<tr>
					<td align="center"><?php echo $no;?></td>
					<td align="center"><?php echo $hasil['id_peserta'];?></td>
					<td ><?php echo $hasil['nama'];?></td>
					<td ><?php echo $hasil['tempat_lahir'].", ".$hasil['tgl_lahir'];?></td>
					<td ><?php echo $hasil['ayah'];?></td>
					<td ><?php echo $hasil['ibu'];?></td>
					<td align="center"><?php echo tgl_ind1($hasil['masa_berlaku']);?></td>
					<td align="center" width="60">
						<?php
							if($hasil['bpjs'] == 'Y' || $hasil['jkn'] == 'Y' || $hasil['is_miskin'] == 'N' || $hasil['pbi'] == 'Y'){
								if($hasil['pbi'] == 'Y'){
									$pbi = "Peserta masuk dalam kategori PBI.";
								}else{
									$pbi = "";
								}
								if($hasil['bpjs'] == 'Y'){
									$bpjs = "Peserta terdaftar sebagai peserta BPJS.";
								}else{
									$bpjs = "";
								}
								if($hasil['jkn'] == 'Y'){
									$jkn = "Peserta masuk dalam kategori penerima JKN.";
								}else{
									$jkn = "";
								}
								if($hasil['is_miskin'] == 'N'){
									$mskn = "Peserta tidak berstatus Miskin.";
								}else{
									$mskn = "";
								}
							?>
								<a href="utama.php?module=mod_jaminan&view=form_tambah&jenis=1&id=<?php echo $hasil['id_penduduk'];?>" onclick="return confirm('<?php echo "$pbi $bpjs $jkn $mskn Apakah ingin dijamin ?"; ?>')">
								<img src="asset/images/add.png" title="Tambah Jaminan Rawat Jalan"></a>
								<a href="utama.php?module=mod_jaminan&view=form_tambah&jenis=2&id=<?php echo $hasil['id_penduduk'];?>" onclick="return confirm('<?php echo "$pbi $bpjs $jkn $mskn Apakah ingin dijamin ?"; ?>')">
								<img src="asset/images/ritl.png" title="Tambah Jaminan Rawat Inap"></a>
							<?php
							}else{
							?>
								<a href="utama.php?module=mod_jaminan&view=form_tambah&jenis=1&id=<?php echo $hasil['id_penduduk'];?>">
								<img src="asset/images/add.png" title="Tambah Jaminan Rawat Jalan"></a>
								<a href="utama.php?module=mod_jaminan&view=form_tambah&jenis=2&id=<?php echo $hasil['id_penduduk'];?>">
								<img src="asset/images/ritl.png" title="Tambah Jaminan Rawat Inap"></a>
							<?php
							}
						?>
					</td>
				</tr>	
		<?php
			}
		?>
		</table>
<?php
	}else{
		echo "Data Peserta tidak ditemukan.";
	}
?>